// 两个二分模板
#include <iostream>
#include <algorithm>

using namespace std;
const int N = 100010;
int a[N];
int n, q;

int main()
{
    cin >> n >> q;
    for(int i = 0; i < n; ++i)
        cin >> a[i];
    while(q--)
    {
        int k;
        cin >> k;
        int pos1 = lower_bound(a , a + n , k) - a;
        int pos2 = upper_bound(a, a + n, k) - a - 1;
        if(pos1 >= n || a[pos1] != k) cout << -1 << ' ' << -1 << endl;
        else cout << pos1 << ' ' << pos2 << endl;
        
    }
    return 0;
}
